home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-apt / examples / update.py < prev    next >
Encoding:
Python Source  |  2009-03-30  |  434 b   |  14 lines

  1. import apt
  2. import apt_pkg
  3. import os.path
  4.  
  5. if __name__ == "__main__":
  6.     apt_pkg.Config.Set("APT::Update::Pre-Invoke::",
  7.                        "touch /tmp/update-about-to-run")
  8.     apt_pkg.Config.Set("APT::Update::Post-Invoke::",
  9.                        "touch /tmp/update-was-run")
  10.     c = apt.Cache()
  11.     res = c.update(apt.progress.TextFetchProgress())
  12.     print "res: ", res
  13.     assert(os.path.exists("/tmp/update-about-to-run"))
  14.